<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="<%= window.location.href %>">每日发货数据</a>
            </li>
        </ol>
    </div>
</header>
<section id="content">
    <div class="panel">
        <form class="form-horizontal" role="form">
            <div class="form-group">
                <div class="col-md-10">
                    <input type="text" id="dateFilter" name="dateFilter" class="form-control text-center" value="<%= options.dateRange[0] %> ~ <%= options.dateRange[1] %>">
                </div>
                <div class="col-md-1">
                    <input type="button" id="search" class="btn btn-primary btn-block form-control" value="搜索">
                </div>
                <div class="col-md-1">
                    <input type="button" id="refresh" class="btn btn-danger btn-block form-control" value="重写">
                </div>
            </div>
        </form>
    </div>

    <div class="panel">
        <table class="table table-striped fs13">
            <thead>
                <tr class="bg-light">
                    <th>日期</th>
                    <th>实物笔数</th>
                    <th>实物金额</th>
                    <th>欧飞笔数</th>
                    <th>欧飞金额</th>
                    <th>微信笔数</th>
                    <th>微信金额</th>
                    <th>福禄笔数</th>
                    <th>福禄金额</th>
                    <th>总笔数</th>
                    <th>总金额</th>
                </tr>
            </thead>
            <tbody class="admin-form">
                <% _.each(items, function(item){ %>
                    <tr>
                        <td><%= item._id %></td>
                        <td><%= item[8] ? item[8].count : 0 %></td>
                        <td><%= item[8] ? item[8].amount.toFixed(2) : 0 %></td>
                        <td><%= item[6] ? item[6].count : 0 %></td>
                        <td><%= item[6] ? item[6].amount.toFixed(2) : 0 %></td>
                        <td><%= item[5] ? item[5].count : 0 %></td>
                        <td><%= item[5] ? item[5].amount.toFixed(2) : 0 %></td>
                        <td><%= item[7] ? item[7].count : 0 %></td>
                        <td><%= item[7] ? item[7].amount.toFixed(2) : 0 %> </td>
                        <td><%= item.total.count %></td>
                        <td><%= item.total.amount.toFixed(2) %></td>
                    </tr>
                <% }) %>
                    <% var len = items.length;
                        if(len > 0){ %>
                    <tr>
                        <td><b>日均</b></td>
                        <td><%= ((info[8] ? info[8].count : 0)/len).toFixed(2) %></td>
                        <td><%= ((info[8] ? info[8].amount : 0)/len).toFixed(2) %></td>
                        <td><%= ((info[6] ? info[6].count : 0)/len).toFixed(2) %></td>
                        <td><%= ((info[6] ? info[6].amount.toFixed(2) : 0)/len).toFixed(2) %></td>
                        <td><%= ((info[5] ? info[5].count : 0)/len).toFixed(2) %></td>
                        <td><%= ((info[5] ? info[5].amount.toFixed(2) : 0)/len).toFixed(2) %></td>
                        <td><%= ((info[7] ? info[7].count : 0)/len).toFixed(2) %></td>
                        <td><%= ((info[7] ? info[7].amount.toFixed(2) : 0)/len).toFixed(2) %> </td>
                        <td><%= (info.total.count / len).toFixed(2) %></td>
                        <td><%= (info.total.amount / len).toFixed(2) %></td>
                    </tr>
                    <tr>
                        <td><b>总计</b></td>
                        <td><%= info[8] ? info[8].count : 0 %></td>
                        <td><%= info[8] ? info[8].amount.toFixed(2) : 0 %></td>
                        <td><%= info[6] ? info[6].count : 0 %></td>
                        <td><%= info[6] ? info[6].amount.toFixed(2) : 0 %></td>
                        <td><%= info[5] ? info[5].count : 0 %></td>
                        <td><%= info[5] ? info[5].amount.toFixed(2) : 0 %></td>
                        <td><%= info[7] ? info[7].count : 0 %></td>
                        <td><%= info[7] ? info[7].amount.toFixed(2) : 0 %> </td>
                        <td><%= info.total.count %></td>
                        <td><%= info.total.amount.toFixed(2) %></td>
                    </tr>
                <% } %>
            </tbody>
        </table>
    </div>
</section>